package com.sxwl.auth.mapper;

import com.sxwl.pojo.ChatMessage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

/**
 * @author reading
 * @Description TODO
 * @Date 2020/4/15 21:53
 */
public interface ChatMessageMapper extends Mapper<ChatMessage> {
    @Select("SELECT COUNT(id) FROM chat_record  WHERE userid=#{userid} AND friendid=#{friendid} AND has_read=0")
    public Integer getHasReadMesage(@Param("userid") Integer userid,@Param("friendid") Integer friendid);


    @Update("UPDATE chat_record SET has_read=1 WHERE userid=#{userid} AND friendid=#{friendid}")
    public void setMeeageRead(@Param("userid") Integer userid,@Param("friendid") Integer friendid);
}
